package com.jsp.controller.departcontroller;

import com.alibaba.fastjson.JSON;
import com.jsp.entity.UserVO;
import com.jsp.mapper.impl.DepartMapperImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

import static com.jsp.controller.usercontroller.UserLoginServlet.getUserVOS;

@WebServlet(name = "DepartListServlet", value = "/departList")
public class DepartListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) {

        try {
            DepartMapperImpl departMapper = new DepartMapperImpl();

            response.setStatus(200);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
            String s = JSON.toJSONString(departMapper.findAll());
            response.getWriter().print(s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
